package com.webchat.rmi.pay;

import com.webchat.common.bean.APIPageResponseBean;
import com.webchat.common.bean.APIResponseBean;
import com.webchat.domain.vo.request.payment.CreateAppRequestVO;
import com.webchat.domain.vo.response.payment.AppBaseResponseVO;
import com.webchat.domain.vo.response.payment.CreateAppResponseVO;
import com.webchat.rmi.interceptor.RpcRequestInterceptor;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "webchat-pay-service",
        contextId = "paymentAppServiceClient",
        configuration = RpcRequestInterceptor.class)
public interface PaymentAppServiceClient {


    /**
     * 支付平台创建应用（接入方）
     *
     * @param createAppRequest
     * @return
     */
    @PostMapping("/pay-service/app/create")
    APIResponseBean<CreateAppResponseVO> createApp(@RequestBody CreateAppRequestVO createAppRequest);

    /**
     * 发布app
     *
     * @return
     */
    @PostMapping("/pay-service/app/publish/{appId}")
    APIResponseBean<Boolean> publishApp(@PathVariable Long appId);

    /**
     * 删除app
     *
     * @param appId
     * @return
     */
    @PostMapping("/pay-service/app/delete/{appId}")
    APIResponseBean<Boolean> deleteApp(@PathVariable Long appId);


    /**
     * 应用列表
     *
     * @param keywords
     * @param pageNo
     * @param pageSize
     * @return
     */
    @GetMapping("/pay-service/app/page")
    APIPageResponseBean<AppBaseResponseVO> page(@RequestParam(value = "keywords", required = false) String keywords,
                                                @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
                                                @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);
}
